home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Packmags
/
NewsFlash - Issue 07 (1990-01)(UGA - 17-Bit Software)(Disk 1 of 2)[a intro].zip
/
NewsFlash - Issue 07 (1990-01)(UGA - 17-Bit Software)(Disk 1 of 2)[a intro].adf
/
sources
/
shake.c
< prev
next >
Wrap
C/C++ Source or Header
|
1996-12-24
|
1KB
|
61 lines
/* SHAKE A SCREEN BY CHANGING THE VIEWPORT LEFT/TOP CORNER */
/* NEEDS MATHTRANS LIBRARY */
/* I THINK THE PROGRAM CAN BE COMPILED WITH AZTEC C: */
/* cc shake +l, ln shake.o -lc32 */
/* HAVE FUN, DR, MAYBE */
#include <exec/types.h>
#include <graphics/view.h>
#include <intuition/intuitionbase.h>
struct IntuitionBase *IntuitionBase;
struct alertmessage
{
SHORT left;
BYTE top;
char text[50];
BYTE flag;
};
struct alertmessage boodschap =
{
240,30,"Not today, I am sea sick!",0
};
main()
{
int i,j,OldX,OldY;
float cos(), sin(), t,s;
if (!(IntuitionBase = (struct IntuitionBase *)
OpenLibrary( "intuition.library", 0L) ))
exit(FALSE);
OldX = IntuitionBase->ActiveScreen->ViewPort.DyOffset;
OldY = IntuitionBase->ActiveScreen->ViewPort.DyOffset;
s = 0.8;
while( s >= 0.025 )
{
for ( t=0; t<6.3; t+=s)
{
i = (int) (32.0*cos(t)+0.5);
j = (int) (32.0*sin(2.0*t)+0.5);
do_shift( i,j);
}
s -= 0.025;
}
do_shift( OldX, OldY);
DisplayAlert( RECOVERY_ALERT, &boodschap, 56);
CloseLibrary( IntuitionBase);
}
do_shift( x, y)
int x,y;
{
IntuitionBase->ActiveScreen->ViewPort.DyOffset = (SHORT) y;
IntuitionBase->ActiveScreen->ViewPort.DxOffset = (SHORT) x;
RemakeDisplay();
}